package edu.sctu.renpingan.ioflow.objectstream;

import edu.sctu.nieyu.day20150504.Text.Output;

import java.io.*;

/**
 * Created by Administrator on 2015/6/15.
 */
public class ObjectStreamMain {
    public static void main(String[] args) throws Exception{

        String file = "E://object.dat";

            ObjectOutputStream object = new ObjectOutputStream(new FileOutputStream(file));
             InputAndOutput inputAndOutput1 = new InputAndOutput("张三","男",52);
               object.writeObject(inputAndOutput1);
               object.close();
        ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(file));
        InputAndOutput inputAndOutput2;
        inputAndOutput2 = (InputAndOutput)objectInputStream.readObject();
        System.out.println(inputAndOutput2);
        objectInputStream.close();

    }
}
